import http from "@/api";

/**
 * 系统分类树形列表
 */
export const cateTreeApi = (params: object) => {
    return http.get(`/cate/tree`, params);
};

/**
 * 系统分类树形缓存
 */
export const cateTreeCacheApi = () => {
    return http.get(`/cate/tree/cache`);
};

/**
 * 新增分类
 * @param params
 */
export const addCateApi = (params: object) => {
    return http.post(`/cate/add`, params);
};

/**
 * 编辑分类
 * @param params
 */
export const editCateApi = (params: any) => {
    return http.put(`/cate/edit/${params.id}`, params);
};

/**
 * 切换分类状态
 * @param id
 */
export const changeStatusApi = (id: number) => {
    return http.put(`/cate/change_status/${id}`);
};

/**
 * 修改排序
 * @param params
 */
export const changeSortApi = (params: object) => {
    return http.post(`/cate/changeSort`, params);
};

/**
 * 删除分类
 * @param id
 */
export const deleteCateByIdApi = (id: number) => {
    return http.delete(`/cate/delete/${id}`);
};

/**
 * 批量删除
 * @param params
 */
export const deleteCateApi = (params: object) => {
    return http.post(`/cate/delete`, params);
};